package com.bwie.common.utils;

public class RadomUtils {

    public static String getRandomString(int length,int type) {
        //String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        String base = "";
        if(0 == type){
            base ="abcdefghijklmnopqrstuvwxyz";
        }
        if(1 == type){
            base = "0123456789";
        }
        if(2 == type){
            base = "abcdefghijklmnopqrstuvwxyz0123456789";
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = (int) (Math.random() * base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(getRandomString(8,2));
    }
}
